package org.base23.video.domain.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 智能视频播放器DTO
 */
@Data
public class SmartVideoPlayerDTO {

    private Long id;
    private Long userId;
    private String resultId;
    private String videoUrl;
    private Double videoDuration;
    private Double frameRate;
    private Integer totalFrames;
    private String status;
    private String errorMessage;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    // 解析后的JSON字段
    private List<KeyMoment> keyMoments;
    private List<SlowMotionSegment> slowMotionSegments;
    private List<PausePoint> pausePoints;
    private List<AnalysisHighlight> analysisHighlights;
    private List<PlaybackInstruction> playbackInstructions;
    private List<ThumbnailTimelineItem> thumbnailTimeline;
    private List<InteractiveTip> interactiveTips;
    private PlayerConfig playerConfig;

    /**
     * 关键时刻
     */
    @Data
    public static class KeyMoment {
        private Double timestamp;
        private String title;
        private String description;
        private String importance; // HIGH, MEDIUM, LOW
        private String category; // 动作类型
    }

    /**
     * 慢放片段
     */
    @Data
    public static class SlowMotionSegment {
        private Double startTime;
        private Double endTime;
        private Double slowRate; // 慢放倍率，如0.5表示半速
        private String reason; // 慢放原因
        private String description;
    }

    /**
     * 暂停点
     */
    @Data
    public static class PausePoint {
        private Double timestamp;
        private String reason; // 暂停原因
        private String tip; // 提示信息
        private Integer duration; // 建议暂停时长(秒)
    }

    /**
     * 分析要点
     */
    @Data
    public static class AnalysisHighlight {
        private Double timestamp;
        private String title;
        private String content;
        private String type; // POSTURE, MOVEMENT, TECHNIQUE, ERROR
        private String severity; // INFO, WARNING, ERROR
        private String suggestion; // 建议
    }

    /**
     * 播放指令
     */
    @Data
    public static class PlaybackInstruction {
        private Double timestamp;
        private String action; // PLAY, PAUSE, SLOW, NORMAL, HIGHLIGHT
        private String parameter; // 参数，如慢放倍率
        private String message; // 显示消息
    }

    /**
     * 缩略图时间轴项
     */
    @Data
    public static class ThumbnailTimelineItem {
        private Double timestamp;
        private String thumbnailUrl;
        private String description;
        private Boolean isKeyFrame;
    }

    /**
     * 交互提示
     */
    @Data
    public static class InteractiveTip {
        private Double timestamp;
        private String type; // TOOLTIP, OVERLAY, HIGHLIGHT
        private String position; // TOP, BOTTOM, LEFT, RIGHT, CENTER
        private String content;
        private Integer displayDuration; // 显示时长(毫秒)
        private String style; // 样式信息
    }

    /**
     * 播放器配置
     */
    @Data
    public static class PlayerConfig {
        private Boolean autoPlay;
        private Boolean showControls;
        private Boolean enableKeyboardShortcuts;
        private Double defaultPlaybackRate;
        private Boolean enableProgressPreview;
        private Boolean showAnalysisOverlay;
        private String theme; // LIGHT, DARK
        private List<String> enabledFeatures; // 启用的功能列表
    }
} 